//
//  ViewController.m
//  CircleCellDemo
//
//  Created by nd on 2019/1/9.
//  Copyright © 2019 ND. All rights reserved.
//

#import "ViewController.h"
#import "CircleCell.h"

@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>{
    NSMutableArray *array;
    UITableView *tableView;
}

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    array = [NSMutableArray array];
    for (NSInteger i=0; i<10; i++) {
        CircleCellMode *mode = [CircleCellMode new];
        mode.name = [NSString stringWithFormat:@"text_%ld", (long)i];
        mode.content = [NSString stringWithFormat:@"text_%ld  :  %f",(long)i, 554654654655465465465465445465454654546546546546545465465465.0*i];
        NSMutableArray *picList = [NSMutableArray array];
        for (NSInteger k=1; k<i+1; k++) {
            [picList addObject:[NSString stringWithFormat:@"timg%ld.jpg",(long)k]];
        }
        mode.picList = picList;
        [array addObject:mode];
    }
   
    tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
    tableView.dataSource = self;
    tableView.delegate = self;
    tableView.estimatedRowHeight=500;
    [self.view addSubview:tableView];
    [tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(UIEdgeInsetsMake(0, 0, 0, 0));
    }];
    
    UIView *sss = [[UIView alloc] initWithFrame:CGRectMake(15, 311.5, 345, 250)];
    sss.backgroundColor = [UIColor redColor];
//    [self.view addSubview:sss];
//    
//    [UIView animateWithDuration:3 animations:^{
//        sss.frame = CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGHT);
//    }];
    
}

#pragma mark - UITableViewDelegate,UITableViewDataSource
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return array.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    CircleCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[CircleCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    cell.mode = array[indexPath.row];
    return cell;
}
@end
